package cn.edu.hust.youth.tzb.servlet.student;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.hust.youth.tzb.dao.TeamDAO;


public class ModifyTeam extends HttpServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static final String CONTENT_TYPE = "text/html; charset=GBK";
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        String teamname=request.getParameter("teamname");
        String username=request.getParameter("username");
        String creattime=request.getParameter("creattime");
        String teamid=request.getParameter("teamid");
        TeamDAO td = new TeamDAO();

        try {
          if( td.modifyTeam(teamid,teamname,username,creattime)){
              
          }
          else{
              
          }
          String target = "/student/viewteam.jsp";
          RequestDispatcher rd = this.getServletContext().getRequestDispatcher(target);
          rd.forward(request,response);

       } catch (Exception ex) {
    	   ex.printStackTrace();
           out.print(ex);
       }
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}

}
